using System;
using System.Collections.Generic;
using System.Text;

namespace SUnit.Core
{
    public enum CallingConvention
    {
        C,
        Pascal,
        Register
    }

    public static class CallingConventionHelper
    {
        public static CallingConvention GetCallingConventionFromStr(string callingConvention)
        {
            if (string.IsNullOrEmpty(callingConvention))
                return CallingConvention.C;

            callingConvention = callingConvention.ToLower();
            if (CallingConvention.C.ToString().ToLower() == callingConvention)
                return CallingConvention.C;
            else if ( CallingConvention.Pascal.ToString().ToLower() == callingConvention)
                return CallingConvention.Pascal;
            else if(CallingConvention.Register.ToString().ToLower() == callingConvention)
                return CallingConvention.Register;            

            throw new ArgumentException("Calling convention desconocida");
        }
    }
}
